﻿using System.Collections.Generic;
using UnityEngine;
namespace FrameWorkSong
{
    public class ResMgr : Singleton<ResMgr>
    {
        public override void OnBeforeDestroy() {
            ShareLoadedAssets.ForEach(loadedAsset => loadedAsset.ReleaseAsset());
            ShareLoadedAssets.Clear();
        }
        public List<Res> ShareLoadedAssets = new List<Res>();
#if UNITY_EDITOR
        private void OnGUI()
        {
            if (Input.GetKey(KeyCode.F1))
            {
                GUILayout.BeginVertical("box");
                ShareLoadedAssets.ForEach(loaderRes =>
                {
                    GUILayout.Label(string.Format("Name:{0} RefCount:{1} State{2}", loaderRes.Name, loaderRes.RefCount,loaderRes.State));
                });
                GUILayout.EndVertical();
            }
        }
#endif
    }
}